/*
 * Created by SharpDevelop.
 * User: michaelo
 * Date: 10/07/2006
 * Time: 19:50
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using Microsoft.Win32;

namespace Orz.LogManager 
{
	/// <summary>
	/// Description of RegistrySettings.
	/// </summary>
	public class RegistrySettings
	{
		public RegistrySettings()
		{
		}
		
		
		public static void Set(string sKey_p, string sValue_p)
		{
			GetDefaultKey().SetValue(sKey_p, sValue_p);			
		}
		
		public static string Get(string sKey_p, string sDefault_p)
		{
			return (string) GetDefaultKey().GetValue(sKey_p, sDefault_p);
		}
		
		private static RegistryKey GetDefaultKey()
		{
			string KEY_NAME = "Software\\Orz\\Log Manager";
			RegistryKey key = Registry.CurrentUser.OpenSubKey(KEY_NAME, true);
			
			if (null == key)
			{
				Registry.CurrentUser.CreateSubKey(KEY_NAME);
				key = Registry.CurrentUser.OpenSubKey(KEY_NAME, true);
			}
			
			return key;
		}
	}
}
